import { createRouter, createWebHashHistory } from 'vue-router'

import Home from '../components/Home.vue'
import List from '../components/List.vue'
import Add from '../components/Add.vue'

const router = createRouter({
    history: createWebHashHistory(),// 创建路由历史记录对象
    routes: [
        {
            path: '/', // 进入项目默认展示的组件
            component: Home
        },
        {
            path: "/home",
            component: Home
        },
        {
            path: "/list",
            components: {
                listView: List,
                default: List
            }
        },
        {
            path: '/showAll',
            redirect: '/list'
        },
        {
            path: "/add",
            component: Add
        }
    ]
});

export default router